package com.allinpay.usdk.dev.aidl;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * 作者 Y_MS
 * Created by ${APEN} on 2017/5/26.
 * GitHub：https://github.com/cxydxpx
 */

public class EthernetConfig implements Parcelable {

//    mode	Int	协议类型
    private int mode;
//    ip	String	本地IP
    private String id;
//    netmask	String	掩码
    private String netmask;
//    gateway	String	网关
    private String gateway;
//    dns1	String	域名服务器1
    private String dns1;
//    dns2	String	域名服务器2
    private String dns2;

    public EthernetConfig() {
    }

    protected EthernetConfig(Parcel in) {
        mode = in.readInt();
        id = in.readString();
        netmask = in.readString();
        gateway = in.readString();
        dns1 = in.readString();
        dns2 = in.readString();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(mode);
        dest.writeString(id);
        dest.writeString(netmask);
        dest.writeString(gateway);
        dest.writeString(dns1);
        dest.writeString(dns2);
    }

    /**
     * 参数是一个Parcel,用它来存储与传输数据
     * @param dest
     */
    public void readFromParcel(Parcel dest) {
        //注意，此处的读值顺序应当是和writeToParcel()方法中一致的
        mode = dest.readInt();
        id = dest.readString();
        netmask = dest.readString();
        gateway = dest.readString();
        dns1 = dest.readString();
        dns2 = dest.readString();
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<EthernetConfig> CREATOR = new Creator<EthernetConfig>() {
        @Override
        public EthernetConfig createFromParcel(Parcel in) {
            return new EthernetConfig(in);
        }

        @Override
        public EthernetConfig[] newArray(int size) {
            return new EthernetConfig[size];
        }
    };

    public void setMode(int mode) {
        this.mode = mode;
    }

    public void setId(String id) {
        this.id = id;
    }

    public void setNetmask(String netmask) {
        this.netmask = netmask;
    }

    public void setGateway(String gateway) {
        this.gateway = gateway;
    }

    public void setDns1(String dns1) {
        this.dns1 = dns1;
    }

    public void setDns2(String dns2) {
        this.dns2 = dns2;
    }

    public int getMode() {
        return mode;
    }

    public String getId() {
        return id;
    }

    public String getNetmask() {
        return netmask;
    }

    public String getGateway() {
        return gateway;
    }

    public String getDns1() {
        return dns1;
    }

    public String getDns2() {
        return dns2;
    }
}
